package cmms.home.vo;

import java.text.DecimalFormat;

public class PointBO extends PointVO {
	private static final String ValueSytle = "0.00";

	// 获取样式名称
	public String getStyle() {
		String result = "point_gray";
		switch (getState()) {
		//状态：0  未连接
		case STATE_NOCONNECT:
			result = "point_gray"; 
			break;
		//状态：1  正常
		case STATE_OK:
			result = "point_green";
			break;
		//状态：2  告警
		case STATE_WARNING:
			result = "point_yellow";
			break;
		//状态：3 错误
		case STATE_ERROR:
			result = "point_red"; 
			break;
		}
		
		return result;
	}
	
	public String getDisplayX() {
		return getDisplayValue(getIntX());
	}

	public String getDisplayY() {
		return getDisplayValue(getIntY());
	}
	
	private String getDisplayValue(int value) {
		DecimalFormat df = new DecimalFormat();
		df.applyPattern(ValueSytle);
		return df.format(((float)value) / 100);
	}
}
